home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
print
/
ds20ae.arj
/
DS20AE.ARJ
/
DS2.MS_
/
DS2.MS
Wrap
Text File
|
1993-08-20
|
25KB
|
885 lines
'**************************************************************************
'* DeskScan II v2.00 Setup
'**************************************************************************
'''$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'ds2util.inc'
'$INCLUDE 'msdetect.inc'
''Constants taken from windows.h (SDK version 3.1)
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H00800000
CONST WS_CLIPCHILDREN = &H02000000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST APPHELP1 = 901
CONST APPHELP2 = 902
CONST APPHELP3 = 903
CONST APPHELP4 = 904
CONST APPHELP5 = 905
CONST APPHELP6 = 906
CONST APPHELP7 = 907
CONST OLDDRIVEROPTION = 1000
CONST MODIFYCONFIG = 1010
CONST MODIFYSYSTEMINI = 1020
CONST INSERTREF = 1050
CONST MODIFYPATH = 1030
CONST SINGLELIST = 1900
CONST GROUPLIST = 2000
CONST CARDOPTIONS = 2010
CONST CARDNOTE = 2015
CONST ERRORSPACE = 2030
CONST EXITSUCCESSASPI = 2035
CONST CHECK = 2500
CONST CUSTINST = 6200
CONST BADPATH = 6400
CONST CDCONFIRMINFO = 7300
CONST ERR_WINDOWSVERSION = 8000
CONST ERR_WINDOWSMODE = 8001
CONST STR_OPTIONALSCSICARD = 8002
CONST STR_DIR = 8003
CONST STR_PROGMANGROUP = 8004
CONST STR_SCANNER = 8005
CONST STR_INTERFACECARD = 8006
CONST ERR_CORRUPTSOURCES = 8007
CONST ERR_PORT = 8000
''Bitmap ID
CONST LOGO = 1
GLOBAL ExtraCosts$ ''List of extra costs to add per drive.
GLOBAL DestCost&
GLOBAL WinCost&
GLOBAL DestFree&
GLOBAL WinFree&
GLOBAL DriversList$
GLOBAL ASPIFound%
GLOBAL CAMFound%
GLOBAL WinMajVer%
GLOBAL WinMinVer%
GLOBAL WinMode%
GLOBAL WinDir$ ''Windows directory.
GLOBAL TwainDir$ ''Directory for the Twain DSM.
GLOBAL DEST$ ''Default destination directory.
GLOBAL OptScanner(2) AS STRING ''Scanner installation option.
GLOBAL ScannerPick$ ''Text for 'ScannerChoice'.
GLOBAL ScannerChoice% '' 1 for ScanJetII family,
'' 2 for ScanJet Plus,
GLOBAL AskModSysIni%
GLOBAL UsingOldDriver%
GLOBAL ConfigFile$
GLOBAL OPTSETUP$ ''Setup type option selection.
GLOBAL OPTCard$ ''Option to use existing card.
GLOBAL OPTCardText(3) AS STRING ''Text for selected card option.
GLOBAL DEFAULTGROUP$ ''Default group name.
GLOBAL GROUP$ ''Selected group name.
GLOBAL SystemArchitecture$ ''Detected architecture.
GLOBAL LISTMADE% ''True if group names list has been
'' made, False otherwise.
GLOBAL DS2Cui$
DECLARE SUB Install
DECLARE SUB CalcCopyCost
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
DS2Cui$ = "ds2cui.dll" ''Custom UI stuff for DS2
'' Verify Windows version and mode.
'' Windows ver. 3.x and Windows NT.
WinMajVer% = GetWindowsMajorVersion()
IF WinMajVer% < 3 THEN
errStr$ = STRING$(128,32)
i% = AcquireString(ERR_WINDOWSVERSION, errStr$, 128)
i% = DoMsgBox(errStr$, "Setup", MB_TASKMODAL+MB_ICONHAND+MB_OK)
dlg% = EXITFAILURE
GOTO QUITL1
END IF
WinMinVer% = GetWindowsMinorVersion()
WinMode% = GetWindowsMode()
IF WinMode% = 0 THEN
errStr$ = STRING$(128,32)
i% = AcquireString(ERR_WINDOWSMODE, errStr$, 128)
i% = DoMsgBox(errStr$, "Setup", MB_TASKMODAL+MB_ICONHAND+MB_OK)
dlg% = EXITFAILURE
GOTO QUITL1
END IF
'' Display main window frame maximized.
hWnd% = HwndFrame()
j% = MoveWindow(hWnd%, 0, 0, GetScreenWidth(), GetScreenHeight(), 0)
'' Create place holders for setup information that will be displayed
'' in a "ConfirmInfo" dialog. One "AddListItem" is needed for each
'' piece of data that will be displayed. The NULLs will be replaced
'' based on information entered by the user.
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
OptScanner(0) = "ScanJet IIp, IIc, IIcx "
OptScanner(1) = "ScanJet Plus "
ScannerPick$ = OptScanner(0)
SystemArchitecture$ = "ISA"
DriversList$ = "SJDrivers"
AddListItem DriversList$, "SJDRIVER.SYS"
AddListItem DriversList$, "MINI400I.SYS"
AddListItem DriversList$, "SJIIX.SYS"
AddListItem DriversList$, "SJII.SYS"
SetSymbolValue "SJIIDriverFound", "0"
SetSymbolValue "WIN30VxD", "WIN400OI.386"
SetSymbolValue "WIN31VxD", "WIN400I.386"
SetSymbolValue "ScannerVxD", "HPSCANR.386"
WinDir$ = GetWindowsDir()
SetSymbolValue "ConfigTemp", "C:\CONFIG.TMP"
SetSymbolValue "AutoexecTemp", "C:\AUTOEXEC.TMP"
SetSymbolValue "SysIniTemp", WinDir$+"SYSTEM.TMP"
SetSymbolValue "ConfigBackup", "C:\CONFIG.DS2"
SetSymbolValue "AutoexecBackup", "C:\AUTOEXEC.DS2"
SetSymbolValue "SysIniBackup", WinDir$+"SYSTEM.DS2"
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
HELP1PROC$ = "FHelp1DlgProc" ''Help dialog procedure
HELP2PROC$ = "FHelp2DLgProc" ''Help dialog procedure
HELP3PROC$ = "FHelp3DLgProc" ''Help dialog procedure
HELP4PROC$ = "FHelp4DlgProc" ''Help dialog procedure
HELP5PROC$ = "FHelp5DlgProc" ''Help dialog procedure
HELP6PROC$ = "FHelp6DlgProc" ''Help dialog procedure
HELP7PROC$ = "FHelp7DlgProc" ''Help dialog procedure
SetBitmap DS2Cui$, LOGO
SetTitle "DeskScan II v2.00 Setup"
'' Get the directory where the setup files are and read the
'' .inf file.
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "DS2.INF"
END IF
ReadInfFile szInf$
DEFAULTGROUP$ = "DeskScan"
GROUP$ = DEFAULTGROUP$
LISTMADE% = 0
OPTSETUP$ = "1"
ScannerChoice% = 1
OPTCard$ = "1"
SetSymbolValue "OPTCard", OPTCard$
cardStr$ = STRING$(128,32)
i% = AcquireString(STR_INTERFACECARD, cardStr$, 128)
OPTCardText(0) = "HP " + cardStr$
i% = AcquireString(STR_OPTIONALSCSICARD, cardStr$, 128)
OPTCardText(1) = cardStr$
OPTCardText(2) = "ScanJet Plus Card"
ASPIFound% = 0
DEST$ = "C:\DESKSCAN"
SetSymbolValue "InstallDir", DEST$
TwainDir$ = WinDir$ + "TWAIN"
AddListItem "SettingsTextIn", DEST$
AddListItem "SettingsTextIn", GROUP$
AddListItem "SettingsTextIn", OptScanner(0)
AddListItem "SettingsTextIn", OPTCardText(0)
AddListItem "DiskSpaceData", MID$(DEST$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", MID$(WinDir$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
DestCost& = 0
WinCost& = 0
DestFree& = 0
WinFree& = 0
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(DS2Cui$, WELCOME, "FInfoDlgProc", APPHELP1, HELP1PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
'' Get information about the system.
IF IsItEISA = 1 THEN
SystemArchitecture$ = "EISA"
SetSymbolValue "SystemArchitecture", "Extended Industry Standard Architecture (EISA)"
'' i% = DoMsgBox("SetUp has detected an EISA system.", "SetUp", MB_TASKMODAL+MB_OK)
ELSEIF IsItMCA = 2 THEN
SystemArchitecture$ = "MCA"
SetSymbolValue "SystemArchitecture", "MicroChannel Architecture (MCA)"
'' i% = DoMsgBox("SetUp has detected an MCA system.", "SetUp", MB_TASKMODAL+MB_OK)
ELSE
SystemArchitecture$ = "ISA"
SetSymbolValue "SystemArchitecture", "AT Backplane"
'' i% = DoMsgBox("SetUp has detected an ISA system.", "SetUp", MB_TASKMODAL+MB_OK)
END IF
'' IF (IsItNT()) THEN
''i% = DoMsgBox("SetUp has detected an NT system.", "SetUp", MB_TASKMODAL+MB_OK)
'' ENDIF
ASPIFound% = FindASPI
CAMFound% = FindCAM
'' Build the (default) copy list and compute the copy cost.
CalcCopyCost
'' Simple or Custom Setup options
OPTION:
'' SetSymbolValue "RadioDefault", OPTSETUP$
OPTL1:
sz$ = UIStartDlg(DS2Cui$, CUSTINST, "FCustomOptDlgProc", APPHELP2, HELP2PROC$)
OPTSETUP$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
OPTSETUP$ = "1"
ELSEIF sz$ = "REACTIVATE" THEN
GOTO OPTL1
ELSEIF sz$ = "CUSTOM" THEN
UIPop(1)
OPTSETUP$ = "2"
ELSE
GOSUB ASKQUIT
UIPop 1
GOTO OPTION
END IF
IF (OPTSETUP$ = "1") THEN
IF DestFree& < DestCost& THEN
sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", APPHELP1, HELP1PROC$)
UIPop 2
GOTO GETPATH
ELSE
UIPop 1
END IF
GOTO PORTCONFLICT
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(DS2Cui$, DESTPATH, "FEditDlgProc", APPHELP3, HELP3PROC$)
DEST$ = GetSymbolValue("EditTextOut")
SetSymbolValue "InstallDir", DEST$
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTION
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
'' Build the (new) copy list and compute the copy cost.
CalcCopyCost
IF (DestFree& < DestCost&) THEN
sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", APPHELP1, HELP1PROC$)
UIPop 2
GOTO GETPATH
ELSE
UIPop 1
END IF
IF OPTSETUP$ = "1" THEN
GOTO PORTCONFLICT
END IF
'' Select which scanner(s) is/are being installed.
CHOOSESCANNER:
ScannerPick$ = ""
ScannerChoice% = 1
CHOOSESCANNERL1:
sz$ = UIStartDlg(DS2Cui$, OPTIONS, "FRadioDlgProc", APPHELP6, HELP6PROC$)
szChoice$ = GetSymbolValue("ButtonChecked")
IF (szChoice$ = "1") THEN
ScannerChoice% = 1
ELSE
ScannerChoice% = 2
OPTCard$ = "3"
SetSymbolValue "OPTCard", OPTCard$
ENDIF
ScannerPick$ = OptScanner(ScannerChoice% - 1)
'' Need to recalc for change from default scanner install
CalcCopyCost
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CHOOSESCANNERL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSE
GOSUB ASKQUIT
GOTO CHOOSESCANNER
END IF
'' Verify that an ASPI manager is in memory. If one is found then
'' give user option to use it or not.
IF (ASPIFound% = 1 OR CAMFound% = 1) THEN
IF (IsDriverInConfig(GetListItem(DriversList$, 2)) = 1) THEN
GOTO GETGROUPNAME
ENDIF
'' i% = DoMsgBox("SetUp has detected a SCSI manager.", "SetUp", MB_TASKMODAL+MB_OK)
GOTO CARDOPTION
ELSE
GOTO GETGROUPNAME
ENDIF
'' Option to use an existing SCSI card. Assumes that the
'' ASPI or CAM manager for the card is already loaded.
CARDOPTION:
'' This option is not available with a ScanJet Plus.
IF (ScannerChoice% = 2) THEN
OPTCard$ = "3"
SetSymbolValue "OPTCard", OPTCard$
GOTO GETGROUPNAME
ENDIF
SetSymbolValue "RadioDefault", OPTCard$
CARDOPTIONL1:
sz$ = UIStartDlg(DS2Cui$, CARDOPTIONS, "FCardOptDlgProc", APPHELP5, HELP5PROC$)
OPTCard$ = GetSymbolValue("ButtonChecked")
SetSymbolValue "OPTCard", OPTCard$
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CARDOPTIONL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO CHOOSESCANNER
ELSE
GOSUB ASKQUIT
GOTO CARDOPTION
END IF
GETGROUPNAME:
IF LISTMADE% = 0 THEN
AddListItem "ListGroupsIn", DEFAULTGROUP$
LISTMADE% = 1
ENDIF
SetSymbolValue "ListGroupsOut", DEFAULTGROUP$
GETGROUPNAMEL1:
sz$ = UIStartDlg(DS2Cui$, GROUPLIST, "FGroupsDlgProc", APPHELP4, HELP4PROC$)
GROUP$ = GetSymbolValue("EditGroupOut")
''i% = DoMsgBox(GROUP$,"Verify Info", MB_TASKMODAL+MB_OK)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETGROUPNAMEL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
IF ASPIFound% = 1 OR CAMFound% = 1 THEN
GOTO CARDOPTION
ELSE
GOTO CHOOSESCANNER
ENDIF
ELSE
GOSUB ASKQUIT
GOTO GETGROUPNAME
END IF
CONFIRMINFO:
genericStr$ = STRING$(128,32)
i% = AcquireString(STR_DIR, genericStr$, 128)
ReplaceListItem "ConfirmTextIn", 1, genericStr$+" : "+DEST$
i% = AcquireString(STR_PROGMANGROUP, genericStr$, 128)
ReplaceListItem "ConfirmTextIn", 2, genericStr$+" : "+GROUP$
i% = AcquireString(STR_SCANNER, genericStr$, 128)
ReplaceListItem "ConfirmTextIn", 3, genericStr$+" : "+ScannerPick$
i% = AcquireString(STR_INTERFACECARD, genericStr$, 128)
IF OPTCard = "1" THEN
ReplaceListItem "ConfirmTextIn", 4, genericStr$+" : "+OPTCardText(0)
ELSEIF OPTCard = "2" THEN
ReplaceListItem "ConfirmTextIn", 4, genericStr$+" : "+OPTCardText(1)
ELSE
ReplaceListItem "ConfirmTextIn", 4, genericStr$+" : "+OPTCardText(0)
END IF
sz$ = UIStartDlg(DS2Cui$, CDCONFIRMINFO, "FConfirmDlgProc", APPHELP1, HELP1PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTION
END IF
PORTCONFLICT:
'' Begin installation
Install
'' ERR = ERR_PORT
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF OPTCard$ = "1" OR OPTCard$ = "3" THEN
dlg% = EXITSUCCESS
ELSE
sz$ = UIStartDlg(DS2Cui$, EXITSUCCESSASPI, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO ALL_DONE
ENDIF
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSEIF ERR = ERR_PORT THEN
sz$ = UIStartDlg(DS2Cui$, EXITFAILURE, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO ALL_DONE
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(DS2Cui$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
ALL_DONE:
END '' This is an exit point for the script.
ERRQUIT:
errStr$ = STRING$(128,32)
i% = AcquireString(ERR_CORRUPTSOURCES, errStr$, 128)
i% = DoMsgBox(errStr$, "Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END '' This is an exit point for the script.
BADPATH:
sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'*************************************************************************
'**
'** Purpose:
'** Builds the copy list and computes the copy cost.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB CalcCopyCost STATIC
'' Start with a clean list.
ClearCopyList
SrcDir$ = GetSymbolValue("STF_SRCDIR")
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
'' Select which "config" files need to be copied
IF SystemArchitecture$ = "EISA" THEN
IF ScannerChoice% = 1 THEN
AddSectionFilesToCopyList "ScanJet II family EISA", SrcDir$, DEST$
ELSEIF ScannerChoice% = 2 THEN
AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
ELSE
AddSectionFilesToCopyList "ScanJet II family EISA", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
END IF
ELSEIF SystemArchitecture$ = "MCA" THEN
IF ScannerChoice% = 1 THEN
AddSectionFilesToCopyList "ScanJet II family MCA", SrcDir$, DEST$
ELSEIF ScannerChoice% = 2 THEN
AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
ELSE
AddSectionFilesToCopyList "ScanJet II family MCA", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
END IF
END IF
'' choose between 'swtchset.exe' and 'sjswitch.exe'
IF ScannerChoice% = 1 THEN
AddSectionFilesToCopyList "ScanJet II family", SrcDir$, DEST$
ELSEIF ScannerChoice% = 2 THEN
AddSectionFilesToCopyList "ScanJet Plus", SrcDir$, DEST$
ELSE
AddSectionFilesToCopyList "ScanJet II family", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus", SrcDir$, DEST$
END IF
AddSectionFilesToCopyList "Windows", SrcDir$, WinDir$
AddSectionFilesToCopyList "Windows:Twain", SrcDir$, TwainDir$
IF (WinMinVer% = 0) THEN
'' AddSectionFilesToCopyList "Windows 3.0 Drivers", SrcDir$, DEST$
IF (NOT DoesFileExist(WinDir$+"SYSTEM\COMMDLG.DLL", femExists)) AND (NOT DoesFileExist(WinDir$+"COMMDLG.DLL", femExists)) THEN
AddSectionFilesToCopyList "Windows 3.0 compat", SrcDir$, WinDir$+"SYSTEM\"
ENDIF
ELSE
AddSectionFilesToCopyList "Windows 3.1 Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "HP Windows Drivers", SrcDir$, DEST$
ENDIF
AddSectionFilesToCopyList "DOS Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "HP SCSI Driver", SrcDir$, DEST$
CostPerDisk$ = "CostPerDisk"
StillNeed& = GetCopyListCost(ExtraCosts$, CostPerDisk$,"")
DestCost& = 0
WinCost& = 0
cost& = 0
FOR i% = 1 to 26 STEP 1
cost& = VAL(GetListItem(CostPerDisk$, i%))
''k% = DoMsgBox("drive ("+CHR$(i% + ASC("A")-1)+") cost ("+str$(cost&)+").", "Copy Costs", MB_TASKMODAL+MB_OK)
NEXT i%
DestDrive$ = MID$(DEST$, 1, 1)
i% = ASC(ucase$(DestDrive$)) - ASC("A") + 1
DestCost& = VAL(GetListItem(CostPerDisk$, i%))
IF (DestCost& < 0) THEN
DestCost& = 0
ENDIF
ReplaceListItem "DiskSpaceData", 1, " " + DestDrive$ + ":"
ReplaceListItem "DiskSpaceData", 2, STR$(DestCost& / 1024) + " K"
drive$ = MID$(DEST$, 1, 1)
DestFree& = GetFreeSpaceForDrive(drive$)
IF (DestFree& < 0) THEN
DestFree& = 0
ENDIF
ReplaceListItem "DiskSpaceData", 3, STR$(DestFree& / 1024) + " K"
WinDrive$ = MID$(WinDir$, 1, 1)
ndrive% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
WinCost& = VAL(GetListItem(CostPerDisk$, ndrive%))
IF (WinCost& < 0) THEN
WinCost& = 0
ENDIF
''i% = DoMsgBox("Windows drive ('"+str$(ndrive%)+"') index in list.", "Copy Costs", MB_TASKMODAL+MB_OK)
ReplaceListItem "DiskSpaceData", 5, STR$(WinCost& / 1024) + " K"
WinFree& = GetFreeSpaceForDrive(WinDrive$)
IF (WinFree& < 0) THEN
WinFree& = 0
ENDIF
ReplaceListItem "DiskSpaceData", 6, STR$(WinFree& / 1024) + " K"
CostPerDisk$ = ""
END SUB
'*************************************************************************
'**
'** Purpose:
'** Performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
CreateDir DEST$, cmoNone
'' OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
CopyFilesInCopyList
''i% = DoMsgBox("Create group "+GROUP$, "HP ScanJet II Setup", MB_TASKMODAL++MB_OK)
CreateProgmanGroup GROUP$, "", cmoNone
ShowProgmanGroup GROUP$, 1, cmoNone
CreateProgManItem GROUP$, "DeskScan II", MakePath(DEST$, "deskscan.exe"), "", cmoOverwrite
CreateProgManItem GROUP$, "SCSI Addresses", MakePath(DEST$, "scsiaddr.exe"), "", cmoOverwrite
CreateProgManItem GROUP$, "Scanner Test", MakePath(DEST$, "scantest.exe"), "", cmoOverwrite
CreateProgManItem GROUP$, "README.TXT", "notepad.exe " + MakePath(DEST$, "readme.txt"), "", cmoOverwrite
'' CloseLogFile
AskModSysIni% = 0
UsingOldDriver% = 0 '' old SCSI Driver
CopyFile "C:\CONFIG.SYS", GetSymbolValue("ConfigBackup"), cmoOverwrite,0
sz$ = UIStartDlg(DS2Cui$, MODIFYCONFIG, "FModifyConfigDlgProc", APPHELP1, HELP1PROC$)
UIPop 1
Test$ = GetSymbolValue("SJIIDriverFound")
IF (Test$ = "1") THEN
sz$ = UIStartDlg(DS2Cui$, OLDDRIVEROPTION, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
UIPop 1
IF (sz$ = "CONTINUE") THEN '' 'Yes' using new driver...
CopyFile GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
AskModSysIni% = 1
Test$ = "0"
ELSE '' 'No' not using new driver...
AskModSysIni% = 0
UsingOldDriver% = 1
IF DoesFileExist(GetSymbolValue("ConfigTemp"), femExists) THEN
RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
ENDIF
ENDIF
ELSE
IF DoesFileExist(GetSymbolValue("ConfigTemp"), femExists) THEN
AskModSysIni% = 1
CopyFile GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
ELSE '' CONFIG.SYS is not being modified --> delete backup file
RemoveFile GetSymbolValue("ConfigBackup"), cmoNone
i% = IsDriverInConfig(GetListItem(DriversList$,3)) '' SJIIX.SYS
IF (i%=1) THEN
AskModSysIni% = 1
ENDIF
ENDIF
ENDIF
sz$ = UIStartDlg(DS2Cui$, MODIFYPATH, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
UIPop 1
IF sz$ = "CONTINUE" THEN
CopyFile "C:\AUTOEXEC.BAT", GetSymbolValue("AutoexecBackup"), cmoOverwrite,0
i% = ModifyAutoexec()
CopyFile GetSymbolValue("AutoexecTemp"), "C:\AUTOEXEC.BAT", cmoOverwrite,0
RemoveFile GetSymbolValue("AutoexecTemp"), cmoNone
ENDIF
IF (AskModSysIni% = 1 AND ScannerChoice% = 1 AND WinMinVer% <> 0 AND OPTCard$ = "1") THEN
sz$ = UIStartDlg(DS2Cui$, MODIFYSYSTEMINI, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
UIPop 1
IF sz$ = "CONTINUE" THEN
CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite,0
i% = ModifySysIni()
RemoveFile WinDir$+"SYSTEM.INI", cmoNone
RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
ENDIF
ENDIF
''i% = DoMsgBox("System Architecture ('"+SystemArchitecture$+"')", "Ref Disk", MB_TASKMODAL+MB_OK)
IF (OPTCard$ = "2") THEN
GOTO DONE '' No need to copy config file for existing card!
ENDIF
'' Configuration file stuff ... do this last because it requires
'' removing the installation disk...
IF (SystemArchitecture$ = "MCA") THEN
IF (ScannerChoice% = 2) THEN
ConfigFile$ = "@601f.adf"
ELSE
IF (ScannerChoice% = 1 OR ScannerChoice% = 0) THEN
IF (AskModSysIni% = 0 OR Test$ = "1") THEN
ConfigFile$ = "@621f.adf"
ELSE
ConfigFile$ = "@631f.adf"
ENDIF
ENDIF
ENDIF
ELSEIF (SystemArchitecture$ = "EISA") THEN
IF (ScannerChoice% = 2) THEN
ConfigFile$ = "!hwp1461.cfg"
ELSE
IF (ScannerChoice% = 1 OR ScannerChoice% = 0) THEN
IF (AskModSysIni% = 0 OR Test$ = "1") THEN
ConfigFile$ = "!hwp2002.cfg"
ELSE
ConfigFile$ = "!hwp2080.cfg"
ENDIF
ENDIF
ENDIF
ELSE '' System Architecture is "ISA"
GOTO DONE
ENDIF
''i% = DoMsgBox("File ('"+ConfigFile$+"')", "Ref Disk", MB_TASKMODAL+MB_OK)
GETREFDISK:
SetSymbolValue "EditTextIn", "A:\"
SetSymbolValue "EditFocus", "END"
GETREFDISKL1:
sz$ = UIStartDlg(DS2Cui$, INSERTREF, "FRefDiskDlgProc", APPHELP1, HELP1PROC$)
refDisk$ = GetSymbolValue("EditTextOut")
tStr$ = refDisk$
IF (MID$(refDisk$,LEN(refDisk$)) <> "\") THEN
refDisk$ = tStr$ + "\"
ENDIF
IF (sz$ = "CONTINUE") THEN
UIPop 1
IF (IsDirWritable(refDisk$) = 0) THEN
GOSUB BADPATH
GOTO GETREFDISKL1
ENDIF
saveCursor% = ShowWaitCursor()
CopyFile DEST$+"\"+ConfigFile$, refDisk$+ConfigFile$, cmoNone, 0
RestoreCursor saveCursor%
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETREFDISKL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO DONE
ELSE
GOSUB ASKQUIT2
GOTO GETREFDISK
ENDIF
GOTO DONE
BADPATH:
sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT2:
sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT2
ELSE
UIPop 1
END IF
RETURN
DONE:
END SUB
'*************************************************************************
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION